package com.oa.controller;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.util.JSONPObject;
import com.oa.po.Leave;
import com.oa.service.LeaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

//请假申请
@RestController
public class LeaveController {
   @Autowired
    LeaveService leaveService;
//提交请假申请接口
    @RequestMapping(value = "/leave",method = RequestMethod.POST)
    public int leave( @RequestBody Leave leave) {

        return leaveService.addLeave(leave);
    }
//查询请假申请接口
    @RequestMapping(value = "/listleave",method = RequestMethod.POST)
    public List<Leave> list_lever(@RequestBody Map map){
        System.out.println(map.get("user_name"));
       String s=(String) map.get("user_name");
        return leaveService.findByUsername(s);

    }

}
